/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.ee.cybertron.energon.loader;

import com.ee.cybertron.energon.base.ServicioBase;
import com.ee.cybertron.energon.components.CyberInputText;
import com.ee.cybertron.energon.components.CyberSelectOneMenu;

/**
 *
 * @author stevenziggiz
 */
public class LoaderComponent {
    
    public LoaderComponent() {
    }
    
    public void obtainValue(CyberInputText inputText, String idColumnName, Integer id){
        Object result;
        ServicioBase servicio = new ServicioBase();
        result = servicio.executeQueryR("Select "+inputText.getColumnReference()+" From cybertron."+inputText.getTableReference()+" Where "+idColumnName+" = "+id+";", null);
        inputText.setValue(result);
    }
    
    public void obtainValue(CyberSelectOneMenu selectOneMenu, String tableName,String idColumnName, Integer id){
        Object result;
        ServicioBase servicio = new ServicioBase();
        result = servicio.executeQueryR("Select "+selectOneMenu.getOptionValueReference()+" From cybertron."+tableName+" Where "+idColumnName+" = "+id+";", null);        
        selectOneMenu.setValue(result);
    }
}
